# Makefile to make Gupicasa releases
#
# Copyright (C) 2010 Yotam Medini <yotam.medini@gmail.com>
#
# This file is part of Gupicasa.
#
# Gupicasa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Gupicasa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gupicasa.  If not, see <http://www.gnu.org/licenses/>.

# Hook to Echo Makefile Variable
ifneq ($(emv),)
emv:
	@echo $($(emv))
endif

.DELETE_ON_ERROR:

ifeq ($(MAKECMDGOALS),trelease)
  NOW := $(shell date "+%Y-%m-%d-%H%M%S")
  VERSION = $(NOW)
else
  VERSION := $(shell python ver.py)
endif

PYFILES = \
	albums.py \
	arith.py \
	cal.py \
	convert.py \
	debug.py \
	gupicasa.py \
	impgdata.py \
	led.py \
	lru.py \
	mosaic.py \
	ped.py \
	pref.py \
	raw.py \
	rect.py \
	ugtk.py \
	uicommon.py \
	uimain.py \
	usys.py \
	ver.py

IMAGES = \
	images/gupicasa.jpeg \
	images/picasa-logo.jpeg

RELEASE_FILES = COPYING README Makefile $(PYFILES) $(IMAGES)

TGZ = /tmp/gupicasa-$(VERSION).tar.gz

default:
	@echo Please use explicit target.
	@echo For example:   make release  or  make trelease
	@false

.PHONY: release trelease
release trelease: $(TGZ)

$(TGZ): ${RELEASE_FILES}
	tar -c -z -f ${TGZ} ${RELEASE_FILES}
	tar tvzf ${TGZ}
	ls -l ${TGZ}
